
import { _decorator, Component, director, Node } from 'cc';
import { SCENE_ENUM } from '../../Enum';
import FaderManager from '../../Runtime/FaderManager';
const { ccclass, property } = _decorator;

/**
 * Predefined variables
 * Name = Start
 * DateTime = Mon Aug 14 2023 13:34:16 GMT+0800 (中国标准时间)
 * Author = zshzshzsh15
 * FileBasename = Start.ts
 * FileBasenameNoExtension = Start
 * URL = db://assets/Script/UI/Start.ts
 * ManualUrl = https://docs.cocos.com/creator/3.4/manual/zh/
 *
 */

@ccclass('StartManager')
export class StartManager extends Component {
    onLoad() {
        // director.preloadScene(SCENE_ENUM.Battle)  //预加载


        FaderManager.Instance.fadeOut(1000)   //渐入检出


        this.node.once(Node.EventType.TOUCH_END, this.handleStart, this)
    }


    async handleStart() {
        console.log("handleStart")
        await FaderManager.Instance.fadeIn(300)
        director.loadScene(SCENE_ENUM.Battle)
    }
}

/**
 * [1] Class member could be defined like this.
 * [2] Use `property` decorator if your want the member to be serializable.
 * [3] Your initialization goes here.
 * [4] Your update function goes here.
 *
 * Learn more about scripting: https://docs.cocos.com/creator/3.4/manual/zh/scripting/
 * Learn more about CCClass: https://docs.cocos.com/creator/3.4/manual/zh/scripting/decorator.html
 * Learn more about life-cycle callbacks: https://docs.cocos.com/creator/3.4/manual/zh/scripting/life-cycle-callbacks.html
 */
